<script setup lang="ts">
import { getBookInfo } from '@/api/getAxios';
import { ref } from 'vue';

const data = defineProps({
    data: String
})
const list = ref()
getBookInfo(<any>data.data).then((res) => {
    list.value = res.data.data
})

</script>
<template>
    <div class="main" v-if="list" @click="$router.push({ path: '/BookInfo', query: { storyId: list.id } })">
        <p><img :src="list.cover" alt=""></p>
        <div>
            <p>{{ list.name }}</p>
            <p>{{ list.authorName }}</p>
            <p>{{ list.introduce }}</p>
            <p>最新章节{{ list.latestChapter }}</p>
        </div>
    </div>
</template>

<style scoped lang='less'>
.main {
    margin: 10px 0;
    display: flex;
    font-family: var(--mfont);
    background-color: white;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;

    &:active {
        background-color: whitesmoke;
    }

    >p {
        min-width: 22%;
        margin-right: 10px;

        img {
            width: 100%;
            border-radius: 8px;
        }
    }

    div {
        display: flex;
        flex-direction: column;
        justify-content: space-around;

        p {
            color: #5d5d5d;
            font-size: .9rem;
        }

        p:nth-child(1) {
            color: black;
            margin-bottom: 2px;
            font-size: 1rem;
        }

        p:nth-child(3) {
            margin-top: 4px;
            word-break: break-all;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
    }
}
</style>